<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>横向伸缩菜单</title>
    <style type="text/css">
        /*初始化*/
        * {
            margin: 0;
            padding: 0;
            font-size: 14px;
        }

        ul {
            list-style: none;
            height: 50px;
            padding-left: 30px;
            border-bottom: 5px solid #f60;
        }

        li {
            float: left;
            margin-top: 20px;
        }

        li a {
            text-align: center;
            text-decoration: none;
            display: block;
            width: 120px;
            height: 30px;
            align: center;
            line-height: 30px;
            color: #000;
            background: #efefef;

        }

        li .on, a:hover {
            background: #f60;
            color: #ffffff;
            height: 40px;
            margin-top: -10px;
            line-height: 40px;
        }
    </style>
    <script>
        window.onload = function () {
            var aA = document.getElementsByTagName('a');
            for (var i = 0; i < aA.length; i++) {
                aA[i].onmouseover = function () {
                    clearInterval(this.time);
                    var This = this;
                    This.time = setInterval(function () {
                        This.style.width = This.offsetWidth + 8 + 'px';
                        if (This.offsetWidth >= 160) {
                            clearInterval(This.time);
                        }
                    }, 30)
                };
                aA[i].onmouseout = function () {
                    clearInterval(this.time);
                    var This = this;
                    This.time = setInterval(function () {
                        This.style.width = This.offsetWidth - 8 + 'px';
                        if (This.offsetWidth <= 160) {
                            This.style.width = "120px";
                            clearInterval(This.time);
                        }
                    }, 30)
                };
            }
        };
    </script>
</head>
<body>
<div>
    <ul>
        <li><a class="on" href="#">首 页</a></li>
        <li><a href="#">新闻资讯</a></li>
        <li><a href="#">产品介绍</a></li>
        <li><a href="#">客户案例</a></li>
        <li><a href="#">联系我们</a></li>
    </ul>
</div>
</body>
</html>